package com.itbaizhan.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/c5")
public class MyController5 {
    @ModelAttribute
    public void before(Model model){
        System.out.println("before");
        model.addAttribute("name", "cuixuefei");

    }

    @RequestMapping("/anno1")
    public String anno1(@ModelAttribute("name") String name){

        System.out.println(name);

        return "baizhan";
    }
}
